<div class="sf_admin_form_row sf_admin_text sf_admin_form_field_external_trainer">
<div>
      <span class="label_cont"><?php echo __('External Trainer?');?></span>
      <div class="content ltr">
      		<input type="checkbox" value="1" name="is_external" id="external_trainer_check" />
      </div>

          </div>
  </div>
  
      <div id="external_trainer_cont" class="sf_admin_form_row sf_admin_text" style="display: none;">
          <?php echo $form['external_trainer']->renderLabel('External trainer name')?>          
          <div class="content ltr">
          	<?php echo $form['external_trainer']->render(); ?>
          </div>
</div>  
  
<script type="text/javascript">
$(document).ready(function(){
	
	function updateExternalTrainer(){
		
		if($('#external_trainer_check').attr('checked')){
			$('#external_trainer_cont').show();
			$('#external_trainer_cont input').removeAttr('disabled');
			$('#program_trainer_id').attr('disabled', 'disabled');
			$('#program_trainer_id').val('');						
		}else{
			$('#external_trainer_cont').hide();
			$('#external_trainer_cont input').attr('disabled', 'disabled');
			$('#external_trainer_cont input').val('');
			$('#program_trainer_id').removeAttr('disabled');
						
		}
	}
	
	$('#external_trainer_check').click(function(){
		updateExternalTrainer();
	});
	
	if('<?php echo $form->getObject()->getExternalTrainer(); ?>' != ''){
		$('#external_trainer_check').attr('checked', 'checked');
	}
	updateExternalTrainer();
	
});
</script>  